#pragma once

#include "action.h"
#include "../../vmath/vec3.h"
#include "../gl/texture.h"

OPEN_JLIB_NS


struct MoveTo : public ContinuedAction {
  void start () override;
  void apply (f32 progress) override;
  bool init (f32 duration, Vec3 to);
protected:
  Vec3 _src;
  Vec3 _dst;
};


struct MoveBy : public MoveTo {
  void start () override;
  bool init (f32 duration, Vec3 delta);
  MoveBy* inverse ();
protected:
  Vec3 _delta;
};


struct RotateTo : public ContinuedAction {
  void start () override;
  void apply (f32 progress) override;
  bool init (f32 duration, Vec3 to);
protected:
  Vec3 _src;
  Vec3 _dst;
};


struct RotateBy : public RotateTo {
  void start () override;
  bool init (f32 duration, Vec3 delte);
  RotateBy* inverse ();
protected:
  Vec3 _delta;
};


struct ScaleTo : public ContinuedAction {
  void start () override;
  void apply (f32 progress) override;
  bool init (f32 duration, Vec3 to);
protected:
  Vec3 _src;
  Vec3 _dst;
};


struct ScaleBy : public ScaleTo {
  void start () override;
  bool init (f32 duration, Vec3 delta);
  ScaleBy *inverse ();
protected:
  Vec3 _delta;
};


struct Animate : public ContinuedAction {
  void start () override;
  void apply (f32 progress) override;
  bool init (f32 duration, const std::vector<Ptr<TexFrame>>& frames);
  bool init (f32 duration, const std::vector<std::string>& frames);
  Animate* inverse ();
private:
  std::vector<Ptr<TexFrame>> _frames;
  Ptr<TexFrame> _currentFrame;
};


CLOSE_JLIB_NS
